vcRoutine

Routine contains a collection of statements that can be executed by the executor.

See in: Overview

Module: vcExecutor

Parent: vcScope

Children: vcProcessRequirements, vcProcessRoutine

Referenced by: vcCallRoutineStatement.CallRoutine, vcProcessExecutor.Processes, vcProgram.MainRoutine, vcProgram.Routines, ... (see more)
vcCallRoutineStatement.CallRoutine
vcProcessExecutor.Processes
vcProgram.MainRoutine
vcProgram.Routines
vcProgram.createRoutine()
vcProgram.findRoutine()
vcStatement.ParentRoutine
vcStatementHelper.GetActiveRoutine()

Properties

Learn how to use properties here. The properties are also inherited from the parent class.

NameTypeAccessDescription
ExecutorvcBehaviorRGets the executor associated with the routine.
IsPersistentBooleanRWGets or sets the value which defines if the routine is saved with the executor.
NameStringRWGets or sets routine name.

Exceptions:
ValueError: When given name is empty or not unique.
PropertiesvcPropertyContainerRGets the properties of this routine.

Methods

Learn how to use methods here. The methods are also inherited from the parent class.

NameReturn TypeParametersDescription
deleteNoneNoneDeletes the routine.

Exceptions:
RuntimeError: When trying to delete a requirements routine.

Example: Access Process Statements

"""Read the process statements of a routine in Process Editor found via process executor behavior."""
import vcCore as vc

comp = vc.getComponent()
exec = comp.findBehavior("ProcessExecutor") # vcProcessExecutor

routine = exec.Processes[0] # vcRoutine that inherits from vcScope
print (routine.Statements) # access the statements of the routine

Example: Create New Process Statement

""" Creates a new process statement and sets the property values."""

import vcCore as vc
import vcExecutor as vc_ex

comp = vc.getComponent()
exec = comp.findBehavior("ProcessExecutor") # vcProcessExecutor

routine = exec.Processes[0] # vcRoutine that inherits from vcScope
new_statement = routine.createStatement(vc_ex.vcStatementType.PROCESS_SET_PROPERTY) # createStatement from vcScope
new_statement.TargetProperty = "x"
new_statement.ValueExpression.Value = "y" # set the value of vcExpressionProperty

Example: Delete Process Statement

""" Deletes a process statement."""

import vcCore as vc

comp = vc.getComponent()
exec = comp.findBehavior("ProcessExecutor") # vcProcessExecutor

routine = exec.Processes[0] # vcRoutine that inherits from vcScope
statement = routine.Statements[0] # take the first statement of the routine
statement.delete()